package com.dk.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dk.pojo.CarCities;
import com.dk.mapper.CarCitiesMapper;
import com.dk.service.CarCitiesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 张成涛
 * @since 2021-08-12
 */
@Service
public class CarCitiesServiceImpl extends ServiceImpl<CarCitiesMapper, CarCities> implements CarCitiesService {
    @Autowired
    private CarCitiesMapper carCitiesMapper;

    @Override
    public List<CarCities> toSelect() {
        return carCitiesMapper.selectList(null);
    }

    @Override
    public CarCities search(String citiesName) {
        QueryWrapper<CarCities> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("citiesName", citiesName);
        List<CarCities> tbUserList = carCitiesMapper.selectList(queryWrapper);
        return tbUserList == null || tbUserList.size() <= 0 ? null : tbUserList.get(0);
    }
}
